zhukovsd / endless-field Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Rendering in the JS client based on canvas layers, every independent logical 'layer' (cells or player labels) render separately, which is convenient.
Within this principle, it would be handy to implement animation rendering on layers.
What information describes an animation:
An animation layer holds an array of animations.
A global tick timer iterates through all animation layers and their animations, calculates the value for the current moment, renders it and refreshes all animation layers.
When browser window size changed, a size of the canvas changes as well. Canvas content gets stretched, breaking the aspect ratio.
Actually, canvas has 2 kinds of sizes, width/height for canvas as UI element, and width/height of its content. When these sizes not matches, aspect ratio breaks.
In order to correctly handle resize, we need to process resize events, and update width/height of canvas content.
When content size gets changed, canvas clears, to it has to be repainted.
If canvas size increases significantly, we might need to request additional chunks from the server. It makes sense to request additional information not on every size change, but only if the size has not changed for some interval, 200 ms, for example.
When a user moves his camera, his scope changes and field manager requests new chunks. During the scrolling, the scope may change only partially, so the user has to receive only new chunks, and there is no need to resend him chunks which he already has.
For example, if user scope = [0, 1], he moves the camera and new scope is [1, 2], the server should only send him chunk with id 2.
So, field endpoint response should look like:
{
"responseCode": 0,
skippedChunks: [
ids of previously requested chunks
],
chunks: [
{
origin, ordered cells array
},
< ... >
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.