GithubHelp home page GithubHelp logo

Comments (4)

robsilv avatar robsilv commented on June 19, 2024

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.

IonSwitz avatar IonSwitz commented on June 19, 2024

@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.

IonSwitz avatar IonSwitz commented on June 19, 2024

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.

robsilv avatar robsilv commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.