Comments (4)
Hi @IonSwitz,
No reason (AFAIK), other than habit. Glad you approve of the code! I'm sure @jonathanrpace will be happy to hear that. :-) Please feel free to change any private variables to protected at your discretion.
Cheers
Rob
from starling-extension-graphics.
@robsilv I am spreading my comments high and low here. I am sorry about that. I have now committed/synched up my latest changes and the clean up of my code. Some changes have been made to a few of the base classes, but it is only made in order to be able to override them.
I haven't done a full sweep of private-to-protected yet, mainly Graphics, Stroke and Fill has been changed. I have also broken out the StrokeVertex to a public class, since that was needed for the post processing. If this is too much a breakage of the "real" API, then I'm not sure how to solve the post processing nicely.
I have some test/sample code to show off this stuff, but I'm not quite sure where to stick it.
In short, it looks like this:
var shape:ShapeEx = new ShapeEx();
shape.blendMode = BlendMode.ADD;
addChild(shape);
shape.graphics.lineMaterial( 1, lavaMaterial);
shape.graphics.moveTo( 900, 550 );
var firstPoint:int = shape.graphics.currentLineIndex; // Grab first index point before we add anything
var controlPoints:Array = [new Point(900, 550), new Point(700, 130), new Point(150, 180), new Point(200, 650), new Point(500, 650), new Point(700, 650)];
shape.graphics.naturalCubicSplineTo(controlPoints, false, 100);
var midPoint:int = shape.graphics.currentLineIndex/2; // Midpoint can be had by dividing length in half.
var endPoint:int = shape.graphics.currentLineIndex-1; // End point is one off the current index.
var colorData:GraphicsExColorData = new GraphicsExColorData(0xFF0000, 0xFFFFFF, 0.0, 1.0);
var thicknessData:GraphicsExThicknessData = new GraphicsExThicknessData(1, 30);
// run postProcess from start to midpoint, go from red to white, alpha 0 to 1, thickness 1 to 30 pixels
shape.graphics.postProcess(firstPoint, midPoint, thicknessData, colorData );
colorData = new GraphicsExColorData(0xDDDDFF, 0xDDFFFF, 1.0, 0.0, null, null);
thicknessData = new GraphicsExThicknessData(30, 1);
// run postProcess from midpoint to end, go from 0xDDDDFF to 0xDDFFFF, alpha 1 to 0, thickness 30 to 1 pixels
shape.graphics.postProcess(midPoint, endPoint, thicknessData, colorData );
from starling-extension-graphics.
Just as GitHub experienced a 10 minute outage, I committed an Example ( 08_GraphicsEx_Spline_Example ) showing the use of the spline code, the postProcessing for color, alpha and thickness (no support for the call back functions yet) and a pretty fun combination of Vertex and Fragment shaders to play with, using the Glow texture of the Lava example.
I am using FlashDevelop, so the project file is for that IDE, and not FDT or whatever the other Examples use. I am unable to create the .project file for this example.
from starling-extension-graphics.
Cool! I look forward to having a play with it tomorrow. :-) Regarding the "real API", the way I see it, there's API 1 and API2.
API 1 is the Flash Graphics API clone. While I don't expect we'll be able to make this blazing fast (from previous conversations with @jonathanrpace), I think it's important to keep this API as similar as possible to the Flash Graphics API to allow Flash devs to get a foothold.
API 2, as demonstrated here and here can be however we like, and will probably be the natural choice for more advanced users who need more control and better performance. So as long as API 1 stays fairly true to Flash Graphics, then please don't feel restricted in augmenting API 2 with whatever you need to make it awesome.
Hope that makes sense!
from starling-extension-graphics.
Related Issues (20)
- graphicsEx.graphics.postProcess() works strange HOT 2
- when draw line and change thickness stroke incorrect HOT 1
- Why it doesn't use ddx/ddy oppcodes for curve drawing? HOT 1
- Stage resize - null material HOT 2
- TypeError: Error #1034 HOT 3
- Width returns 0 HOT 4
- Shapes cannot be touched HOT 1
- Texture no repeat in TextureVertexColorFragmentShader HOT 8
- Texture restoration after context loss HOT 3
- Duplicate variable definition of function paramters HOT 5
- extra comma in TextureMaterial class HOT 1
- graphics.moveTo doesn't work in this situation HOT 3
- Starling 2 HOT 46
- Add and update dependency version HOT 1
- Context loss SEG not recovering - No valid program set. HOT 5
- starling.core.RenderSupport problem with Starling 2 HOT 4
- Readme needs more detail
- Error #3600: No valid program set. HOT 3
- Stroke Problem
- Is TextureFill supported with starling 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starling-extension-graphics.