exyte / macaw Goto Github PK
View Code? Open in Web Editor NEWPowerful and easy-to-use vector graphics Swift library with SVG support
License: MIT License
Powerful and easy-to-use vector graphics Swift library with SVG support
License: MIT License
We should make sure that we are using the same code style through whole project
Path will be tracked in a separate issue.
For example, Font and Fill don't have default values.
If some classes removed from Kaway sources (like Parent) they should be removed from the Macaw sources during generation.
Currently only relative transformation supported.
Problems:
// need to say 'opacity' twice, need to say 'node' twice
OpacityAnimation(animatedNode: node, observableValue: node.opacityVar, ...)
// it allows user to make errors
OpacityAnimation(animatedNode: node1, observableValue: node2.opacityVar, ...)
MacawView.addAnimation
which makes API imperative VS declarative.Proposal:
For every animatable property use AnimatableVariable
, which has reference to Node, understand property type and has 'animate' method:
public class AnimatableVariable<T: Interpolable> : Variable<T> {
public func animate(from: T, to: T, during: Double, ...) -> Animation
}
This method automatically register animation in global registry which then delegates to appropriate MacawView.
// current
let animation = OpacityAnimation(animatedNode: ballGroup, observableValue: ballGroup.opacityVar, startValue: 0.1, finalValue: 1.0, animationDuration: 3.0)
view.addAnimation(animation)
...
animation.stop()
// proposed
let animation = ballGroup.opacityVar.animate(from: 0.1, to: 1.0, during: 3.0)
...
animation.stop()
For example,
class Group: Node, Parent { }
See DropShadow
class, the API is similar to CALayer.shadow...
properties.
I've added model to the repo. The following code can be useful to draw radial gradient in Macaw:
let context = UIGraphicsGetCurrentContext()
let minSize = min(bounds.size.width, bounds.size.height)
let options: CGGradientDrawingOptions = [.DrawsAfterEndLocation]
// get from stops
let colors: CFArray = [UIColor.redColor().CGColor, UIColor.blueColor().CGColor]
let locations : [CGFloat] = [0.0, 1.0]
let gradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), colors, locations)
// radial gradient parameters
let cx = 0.5 * minSize
let cy = 0.5 * minSize
let fx = 0.25 * minSize
let fy = 0.25 * minSize
let r = 0.5 * minSize
CGContextDrawRadialGradient(context, gradient, CGPoint(x: fx, y: fy), 0, CGPoint(x: cx, y: cy), r, options)
See GaussianBlur
and Node.effect
. Useful links:
https://dzone.com/articles/applying-gaussian-blur-to-uiviews-with-swift-proto
https://www.raywenderlich.com/84043/ios-8-visual-effects-tutorial
scene:
Group.contentsVar
to Group.contents
Node.pos
needs a better nameDrawable.bounds
from the modelText.font
optionalImage.xAlign/yAlign/aspectRatio
properties are too complicated and clumsydraw:
AspectRatio
Color
to Fill
FontStyle
and FontWeight
Font.bold/italic/underline/strike
properties. Need a better solution for Macaw.Gradient.userSpace
needs a better namegeometry:
Sector
classTransform.invert
should return nil when doesn't existMove
-> MoveTo
, PLine
-> LineTo
Currently: NSObject, expect: Bool.
This makes examples too difficult, so need to be done before release.
Currently Kaway doesn't support non-nullable types which means that all fields should be nullable by default. It's important because currently Group has non-nullable clip field which means it can't be used without clipping.
All coordinates inside layer are always positive. With anchor point (0, 0). In case of rotation transform it leads to incorrect layer position
Node.clip: Locus
Otherwise they are not accessible from another project.
In Kaway every type has default value. Please use this value (or field default) in constructor. Currently objects with 5+ fields really hard to initialize.
For example, check out Quadratic
Check rotation case.
We should you Swift 3.0 policy for this.
That's what we need:
What we DO NOT need:
For example, Node.place
changes ignored.
<feOffset dx="2" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="10" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
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.