mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-14 17:09:30 +02:00
Add continuous drawing mode. Add new brushes. Remove some brushes. Fix animation play distance for when painting in Desktop mode. Fix Hue animation not starting from the chosen color (would always start from red). Fix multiple color polyline.
30 lines
No EOL
1.4 KiB
JavaScript
30 lines
No EOL
1.4 KiB
JavaScript
//Superclass
|
|
Script.include("animatedBrush.js");
|
|
Script.include("../../ColorUtils2.js");
|
|
|
|
function AnimatedHueBrushClass(settings, entityID) {
|
|
//Animated brush vars
|
|
AnimatedBrush.call(this);
|
|
//print("Starting animated hue brush");
|
|
this.hsvColor = rgb2hsv(Entities.getEntityProperties(entityID).color);// {hue: 0, saturation: 1.0, value: 1.0};
|
|
this.animatedColor = {red: 0, green: 0, blue: 0};
|
|
}
|
|
|
|
AnimatedHueBrushClass.prototype.ANIMATED_BRUSH_TIME = 10; //inteval in milliseconds to update the brush width;
|
|
AnimatedHueBrushClass.prototype.ANIMATED_BRUSH_INCREMENT = 0.5; //linear increment of brush size;
|
|
AnimatedHueBrushClass.prototype.NAME = "animatedHueBrush";
|
|
|
|
AnimatedHueBrushClass.prototype.onUpdate = function(deltaSeconds, entityID) {
|
|
//print("Animated Hue Brush");
|
|
this.hsvColor.hue = this.hsvColor.hue + ((deltaSeconds * this.ANIMATED_BRUSH_INCREMENT)/this.ANIMATED_BRUSH_TIME);
|
|
this.hsvColor.hue = this.hsvColor.hue >= 360 ? 0 : this.hsvColor.hue; //restart hue cycle
|
|
this.animatedColor = hsv2rgb(this.hsvColor);
|
|
Entities.editEntity(entityID, { color : this.animatedColor});
|
|
this.parent.updateUserData(entityID, this);
|
|
}
|
|
|
|
//AnimatedHueBrushClass.prototype = Object.create(AnimatedBrush.prototype);
|
|
AnimatedHueBrushClass.prototype.constructor = AnimatedHueBrushClass;
|
|
AnimatedHueBrushClass.prototype.parent = AnimatedBrush.prototype;
|
|
|
|
AnimatedHueBrush = AnimatedHueBrushClass; |