I am trying to give an ellipse in my Stage (I am using React) a gradient color, like css's border-color with a linear gradient.
I have tried to use strokeLinearGradientColorStops, that will show an empty ellipse. I have also tried using strokeLinearGradientColorStops + strokeLinearGradientStartPoints + StrokeLinearGradientEndPoint, but that turned out weird: when I move my circle around the Stage the gradient will be different, so it was like a gradient color applied to the entire Stage and only showing up on the ellipse
<Ellipse
strokeLinearGradientStartPoint={{ x: 0, y: 0 }}
strokeLinearGradientEndPoint={{ x: 200, y: 150 }}
strokeLinearGradientColorStops={[0, "blue", 1, "yellow"]}
/>
Ofcourse given the parameters of strokeLinearGradientStart and endPoint, I should expect the color to be applied to the stage instead of the element.
If this was the expected result, is there anyway around it? I have also tried to select these elements in css, but Stage maps to a canvas so I don't think I can access the individual elements as they are just pixels.
Related
I'm having problems using pdb.gimp_by_color_select in Gimp
I've already looked at this question
Here's what I have:
# duplicate layer
duplicate_layer(image, "temp")
tempLayer = pdb.gimp_image_get_active_layer(image)
colour = (0,0,0)
operation = 0
pdb.gimp_selection_none(tempLayer)
pdb.gimp_by_color_select(tempLayer, colour, 0, operation, True, False, 0, True)
Only it doesn't select any of the black pixels in the newly duplicated templayer as I would expect it.
Here's a snippet of the image
The lines are not true black (0,0,0) but I do an auto levels
# Auto layers
pdb.gimp_drawable_levels_stretch(tempLayer)
on the image beforehand
If you look at the picture histogram, the "black" is actually a fairly wide range, from 40 to 100 with a peak around 75:
And even after a level-stretch, most of your black pixels are still not completely black:
You would get a better result by thresholding the image around 100, if necessary using another copy of the layer (a selection applies to any any layer of the image, regardless of the layer used to obtain it).
I don't know which numbers do what in the coordinates example here. I imagine they mean things like place the top left corner at this position and the bottom right corner at this position, but I don't know which number corresponds to which position.
I've been trying to fool around with the numbers to get a small green rectangle but keep getting weird results like the following, and don't know which numbers need to be what is order to make the rectangle symmetrical and at the bottom
This is what the rectangle should look like
The height of the rectangle is 50, the height of the screen is 1000, and the width of the screen is 1700.
Here's my draw function
function love.draw()
love.graphics.setColor(0.28, 0.63, 0.05) -- set the drawing color to green for the ground
love.graphics.polygon("fill", objects.ground.body:getWorldPoints(objects.ground.shape:getPoints())) -- draw a "filled in" polygon using the ground's coordinates
-- These are the grounds coordinates. -11650 950 13350 950 13350 1000 -11650 1000
love.graphics.setColor(0.76, 0.18, 0.05) --set the drawing color to red for the ball
love.graphics.circle("fill", objects.ball.body:getX(), objects.ball.body:getY(), objects.ball.shape:getRadius())
love.graphics.setColor(0.20, 0.20, 0.20) -- set the drawing color to grey for the blocks
love.graphics.polygon("fill", objects.block1.body:getWorldPoints(objects.block1.shape:getPoints()))
love.graphics.polygon("fill", objects.block2.body:getWorldPoints(objects.block2.shape:getPoints()))
print(objects.block1.body:getWorldPoints(objects.block1.shape:getPoints()))
end
As described at https://love2d.org/wiki/love.graphics, Löve's coordinate system has (0, 0) at the upper left corner of the screen. X values increase to the right, Y values increase down.
The polygon function expects the drawing mode as it's first parameter, and the the remaining (variable) parameters are the coordinates of the vertices of the polygon you wish to draw. Since you want to draw a rectangle you need four vertices/eight numbers. You do not have to list the upper left corner of the rectangle first, but that's probably the easiest thing to do.
So in your case, you want something like:
love.graphics.polygon('fill', 0, 950, 0, 1000, 1700, 1000, 1700, 950)
I've not worked with the physics system, so I'm not quite sure how it's coordinate system relates to "screen" coordinates. The values you show in the comment in your code listing seem like they should give a rectangle (although x = -11650 wouldn't be on screen). You might try experimenting without the physics system first.
Also, since the physics system in Löve is just a binding to Box2D, you might want to read its documentation (http://box2d.org/about/). Not really sure what you're trying to do with feeding shape:getPoints into body:getWorldPoints.
I have to do a line charts with threshold y=5 where y>5 circle color is green y<5 circle color is red and circle y=5 circle color is orange. Using simple threshold i can draw only 2 color in red and green but i can't do the orange one.
{
name: 'Series1',
data: [
{y:2},
{y:6},
{y:5},
{y:6.5},
{y:3},
{y:10}
],
threshold: 4,
negativeColor: "red",
color: "green"
}
How can i do my chart with 3 color circle using threshold? and how can i take color only in circle but grey in line connected circle?
To do what you are asking will require using multiple series, as in this example:
http://jsfiddle.net/jlbriggs/yHn2D/
You can use the linkedTo property to make them all sit under one legend entry.
However, this kind of display inevitably leads to a a cluttered, overly colored, hectic display.
My example, even though the colors are toned down, looks a bit circus-like.
I would be much more inclined to do soemthing like this:
http://jsfiddle.net/jlbriggs/yHn2D/3/
Highlight the target range on the chart, in a subtle manner. When looking at such a chart day after day, watching for data that is outside of the acceptable range, a chart like this will make it very easy to see.
A chart that highlights every singly point, with multiple colors, whether they require attention or not, will drown the important information in visual clutter.
FWIW.
I have a pretty complex animation of a fireball. I'm using it as an attack for an enemy in a game. I want to be able to simply switch all the colors in the fireball and that's it, just so when a different enemy fires the fireball they are different colors. Editing each individual frame is sort of out of the picture. I'm really struggling with a few things.
1) Whenever I duplicate symbol to start editing, whatever edits I make on that symbol automatically change the original symbol! AHHHH!
2) Changing the color for the fireball is too complex to go through frame by frame. Is there some way I can just invert all the colors or change the hue on all frames or something? Right now when I make a new movieclip of the original fireball, it is a complex mass of objects (becoming a "mixed"). This doesn't allow me to change any color settings, just the width and positioning. I would have to break apart each mixed object, change ALL the different objects, and then do that for every frame! Not happening!
3) I tried putting a sheet of a certain color on the top layer and then putting the alpha pretty low, but unfortunately it just doesn't look good. The flames on the end are always changing position, etc, so a sheet just doesn't do the fireball justice.
Thanks for the help =)
ColorMatrices!!!
var colorMatrix: Array = new Array(
[[0, 0, 1, 0, 0], //red is now the old blue
[0, 1, 0, 0, 0], //Green component stays the same
[1, 0, 0, 0, 0], //I channel the old red to blue
[0, 0, 0, 1, 0]]);
var colorFilter: ColorMatrixFilter(colorMatrix);
yourFireBall.filters = [colorFilter];
I wrote in in browser but this should do the job.
I have one shape
var a = paper.rect(10,10,50,20);
I want to transform this shape into
var b = paper.circle(10,10,20);
Is there any way to transform these inbuilt shapes into one another. I know paths can be transformed anyhow you want them to but can shapes also be transformed?
You can do this if with a little creativity. A rectangle can be a circle if width, height and r (radius) are all the same. Then transforming a rect to a "circle" becomes:
p=Raphael(10, 50, 600, 300);
myrect=p.rect(50,50, 300,150,0).attr({"fill":"cyan"});
myrect.animate({"width":25,"height":25, "r":25}, 3000);
JSfiddle: http://jsfiddle.net/s1pz6Lzc/30/
I don't think that is possible, except if you simply fade out one shape and fade in the other one. The reason for this is that at some point in time during the conversion the shape is neither a rectangle nor a circle, while any single animated shape in SVG has to remain the same kind of shape throughout the animation, I believe.