Prototypo canvas-rendering component
byte-foundry / prototypo-canvas Goto Github PK
View Code? Open in Web Editor NEWPrototypo canvas-rendering component
License: MIT License
Prototypo canvas-rendering component
License: MIT License
Loading venus.ptf locks the UI for roughly 2s on my computer
The idea is to develop a new canvas API that would be immediate and functionnal. By immediate it is meant that there would be the least amount of data retention in the canvas library. Prototypo-canvas will handle the raf itself.
The canvas library should provide a drawing API to draw curves, lines, ellipsises, rectangle and text. It should also let us declare which element are to be interacted with and it should provide a way to determine the hotness of an element (ie which element is currently under the mouse). It should also provide the mouse position on the canvas.
Here is an exemple of what a raf iteration would look like:
function rafIteration() {
setCamera(point, zoom);
_.each(contours, (contour) => {
drawContour(contour.controlPoints, undefined, letterFillColor);
});
if (drawSkeleton) {
contours.getSkeleton(contours.getSkeletons(), (skeleton) => {
drawRectangleFromCenterSize(skeleton.node, skeletonSize, skeletonStrokeColor, undefined, 'skeleton');
drawLine(skeleton.expandedTo[0], skeleton.expandedTo[1], skeletonRibStrokeColor, undefined);
});
}
const hotItem = getHotInteractiveItem();
switch(hotItem.type) {
case 'skeleton':
doSomethingDependingOnState();
break;
}
}
drawContour(listOfBezier, strokeColor, fillColor, interactionType)
drawBezierCurve(bezier, strokeColor, fillColor, interactionType)
drawLine(point, point, strokeColor, fillColor, interactionType)
drawRectangleFromCenterSize(point, size, strokeColor, fillColor, interactionType)
drawCircle(point, radius, strokeColor, fillColor, interactionType)
drawText(text, point, textSize, textColor, interactionType)
The API should mostly rely on traits (meaning arguments must fullfil a non declarative interface). Here are the differents traits:
listOfBezier = Array<bezier>
bezier= Array[4]<point>
point= {x: number, y: number}
strokeColor = fillColor = textColor = string of format rgba(number, number, number, number)
doSomethingDependingOnState();
=======WIP=======
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.