• HTML5 canvas column


    1、 Canvas element The drawing function of canvas element is shown by its context object, and the environment variable can be obtained from canvas element. html: <canvas id=”canvas” width=”300″ height=”150″> Canvas not supported </canvas> css: body{background-color:#eee;} #canvas{ border: 1px solid #333; } javascript: var ctx = document.querySelector(‘#canvas’).getContext(‘2d’); ctx.strokeStyle = ‘red’; ctx.strokeRect(0,0,100,100); 1. By default, the […]

  • Canvas write a simple game


    BeforeHTML5 canvas properties and Methods SummaryIn this article, I have introducedCanvasThe various properties and methods of the description, and lists some of their own writingCanvas demoNext, let’s start to write a simple game. How simple is it? Let’s say that the code is less than 100 lines. First, the rendering:The left side is our control […]

  • Adventure of activity display interface


    preface stayActivity display viewThere are some important roles that people can’t understand clearly, such asPhoneWindow、DecorView、ViewRootImpl。 Also often have the interview question to be able to ask, between them four relations? When to create it? When is the first time view draws? And so on. So today, let’s start with youActivityStart to see what steps will […]

  • JavaScript graphic example: H fractal


    H fractal is a kind of fractal pattern evolved from a letter H into a labyrinth like scene. Its construction process is as follows: take a center point (x, y), and draw a horizontal line with length L and two vertical lines with length h from this center point to form a letter “H” shape; […]

  • Redux: from action to Saga


    The missing part of front end application A modern, usedreduxThe front-end application architecture of can be described as follows: A store that stores the application’s immutable state States can be drawn in components (HTML or something else). This rendering method is usually simple and testable (not always) pure. const render = (state) => components Component […]

  • Regression model of deep learning simple linear model


    Regression model of deep learning simple linear model Data set generation from sklearn.model_selection import train_test_split from sklearn import datasets import matplotlib.pyplot as plt from tensorflow import keras X,y = datasets.make_regression(n_samples=10000,noise=0,random_state=8,n_informative=1,n_features=1) plt.scatter(X,y,c=’blue’) plt.show() Defining linear models model = keras.models.Sequential([ keras.layers.Dense(1,input_shape = X_train.shape[1:])] ) model.summary() Training model model.compile(loss = keras.losses.mean_squared_error,optimizer=keras.optimizers.Adam(),metrics=[‘mse’]) history = model.fit(X,y,epochs=1000,validation_split=0.25,callbacks=[keras.callbacks.EarlyStopping(patience=3)]) Draw a loss history […]

  • JavaScript graphic example: hexaflake fractal like snowflake


    Write the following function:    function drawHexagon(x,y,L)    {         ctx.beginPath();         ctx.moveTo(x-sqrt3/2*L,y-L/2);         ctx.lineTo(x-sqrt3/2*L,y+L/2);         ctx.lineTo(x,y+L);         ctx.lineTo(x+sqrt3/2*L,y+L/2);         ctx.lineTo(x+sqrt3/2*L,y-L/2);         ctx.lineTo(x,y-L);         ctx.closePath();         ctx.fillStyle = “#00FFFF”;         ctx.fill();    } The value of sqrt3 in the function is math. Sqrt (3). The function is: take the coordinate (x, y) as the center […]

  • Use Zebra printer to print pictures


    2021 Zebra printer to print custom pictures This article is forbidden to reprint, for reference only1. >Use the graphic class of C # to draw the print effect picture you want in your own program [simple and crude, that is, cumbersome, always adjust the style of the picture, publish IIS available] or use copyfromscreen() to […]

  • UE4 / Unity: basic elements of map drawing — surface and volume


    preface Drawing map basic element line based on UE4 / Unity (Part 1) Drawing map basic element line based on UE4 / Unity (Part 2) After drawing lines on the map, the next step is to draw faces and volumes As one of the basic elements of map rendering, surface can represent all kinds of […]

  • Canvas animation – circular diffusion, motion trajectory


    introduce I’ve seen this circular diffusion effect in ecarts, which is similar to CSS3. I just want to use it in the project, but I don’t want to introduce the entire ecart.js file. What’s more, I want to understand its principle, so I do it myself. In this article, we will analyze the two methods […]

  • Kotlin round progress bar


    Custom round progress bar of kotlin version Most start-up pages have a progress bar loading style, so I rewrite it with kotlin. If it’s really cool, there are still many things to add A simple progress bar is basically composed of a background ring and a progress ring. What we need to pay attention to […]

  • Take you to use Python to make four games with piggy page.


    The text and pictures of this article are from the Internet, only for learning and communication, and do not have any commercial use. The copyright belongs to the original author. If you have any questions, please contact us in time The following article comes from Tencent cloud Author: Python advanced (want to learn Python? Python […]