Class Kinetic.Shape
Extends
Kinetic.Node.
Defined in: kinetic.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Kinetic.Shape(config)
Shape constructor.
|
Method Attributes | Method Name and Description |
---|---|
helper method to set the line join of a shape
based on the lineJoin property
|
|
clear shape data
|
|
helper method to fill and stroke a shape
based on its fill, stroke, and strokeWidth, properties
|
|
get shape temp layer canvas
|
|
get layer context where the shape is being drawn.
|
|
getFill()
get fill
|
|
get line join
|
|
get stroke color
|
|
get stroke width
|
|
determines if point is in the shape
|
|
saveData()
save shape data when using pixel detection.
|
|
setDrawFunc(func)
set draw function
|
|
setFill(fill)
set fill which can be a color, gradient object,
or pattern object
|
|
set line join
|
|
setStroke(stroke)
set stroke color
|
|
setStrokeWidth(strokeWidth)
set stroke width
|
|
stroke()
helper method to stroke shape
|
- Methods borrowed from class Kinetic.Node:
- draggable, getAbsoluteAlpha, getAbsolutePosition, getAbsoluteTransform, getAbsoluteZIndex, getAlpha, getAttrs, getCenterOffset, getDetectionType, getDragBounds, getDragConstraint, getLayer, getLevel, getName, getParent, getPosition, getRotation, getRotationDeg, getScale, getStage, getTransform, getX, getY, getZIndex, hide, isDragging, isVisible, listen, move, moveDown, moveTo, moveToBottom, moveToTop, moveUp, off, on, rotate, rotateDeg, setAbsolutePosition, setAlpha, setAttrs, setCenterOffset, setDefaultAttrs, setDetectionType, setDragBounds, setDragConstraint, setPosition, setRotation, setRotationDeg, setScale, setX, setY, setZIndex, show, transitionTo
Class Detail
Kinetic.Shape(config)
Shape constructor. Shapes are used to objectify drawing bits of a KineticJS
application
- Parameters:
- {Object} config
- {String|CanvasGradient|CanvasPattern} config.fill Optional
- fill
- {String} config.stroke Optional
- stroke color
- {Number} config.strokeWidth Optional
- stroke width
- {String} config.lineJoin Optional
- line join. Can be "miter", "round", or "bevel". The default is "miter"
- {String} config.detectionType Optional
- shape detection type. Can be "path" or "pixel". The default is "path" because it performs better
Method Detail
applyLineJoin()
helper method to set the line join of a shape
based on the lineJoin property
clearData()
clear shape data
fillStroke()
helper method to fill and stroke a shape
based on its fill, stroke, and strokeWidth, properties
getCanvas()
get shape temp layer canvas
getContext()
get layer context where the shape is being drawn. When
the shape is being rendered, .getContext() returns the context of the
user created layer that contains the shape. When the event detection
engine is determining whether or not an event has occured on that shape,
.getContext() returns the context of the invisible path layer.
getFill()
get fill
getLineJoin()
get line join
getStroke()
get stroke color
getStrokeWidth()
get stroke width
intersects()
determines if point is in the shape
saveData()
save shape data when using pixel detection.
setDrawFunc(func)
set draw function
- Parameters:
- {Function} func
- drawing function
setFill(fill)
set fill which can be a color, gradient object,
or pattern object
- Parameters:
- {String|CanvasGradient|CanvasPattern} fill
setLineJoin()
set line join
- Parameters:
- {String} lineJoin.
- Can be "miter", "round", or "bevel". The default is "miter"
setStroke(stroke)
set stroke color
- Parameters:
- {String} stroke
setStrokeWidth(strokeWidth)
set stroke width
- Parameters:
- {Number} strokeWidth
stroke()
helper method to stroke shape