I need to animate Heigth and Width of the Clip Rect using Story, If I write like below code
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(UIElement.Clip).(RectangleGeometry.Rect).Height" Storyboard.TargetName="ellipse">
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="55"/>
</DoubleAnimationUsingKeyFrames>
Designer crash and says Cannot resolve TargetProperty (UIElement.Clip).(RectangleGeometry.Rect).Height.
How to overcome this !!!
Thanks in advance.
Animating its Width/Height is not the best idea since those are dependent properties. I'd use a ScaleTransform on the RectangleGeometry and animate that. You should be able to name the transform and target the transform directly instead of using complicated target property paths. If that doesn't work - I'd set the target in code behind.
Related
I am using easel js for working with a drawing application and have functionality like resize rotate etc. For a task I need to write a letter on a image and used a container and added image and text as children.
Now the issue if I transform the container I don't need to reverse the letter only image.
I am using the following link for transformation:
https://github.com/senocular/TransformTool
Attach: https://www.dropbox.com/s/vxg84liohd24knh/Untitled.png?dl=0
If you are able to target the sub-content, you can un-transform it simply using:
// Simple un-flip
clip.subClip.scaleX = 1/clip.scaleX;
If you need more complex un-transforms, you might need to spend some time on the math to do that for each property, or look into Matrix transformations.
The easiest way is to decouple the element from the container. Have it be a sibling that updates its position to match. This gives you much better control over the display.
I am painting on a window simple html using QTextDocument::drawContents(painter)
I want to do the drawing inside some margins in the window but I don't see a direct way to specify the target rectangle of the painting (in the painter/window).
I guess a few ways to do it:
Using the QTextDocuments::setMargin (although this does not allow different values for left/top.
Placing the html into an styled <div>
Applying a translation transform to the painter.
But all this seems a bit too much for what I want to do and I guess if I a missing something straight (as you do with QPainter::drawText where you tell the target rectangle)
Set the textWidth property to the width of the area where the text is supposed to fit. The clipping rectangle you pass to drawContents will cut the text off vertically if there's too much of it to fit; you can't do much about that of course.
So, this would be the missing function you're after:
void drawContents(QPainter * p, QTextDocument & doc, const QRectF & rect) {
p->save();
p->translate(rect.topLeft());
doc.setTextWidth(rect.width());
doc.drawContents(p, rect);
p->restore();
}
Yes, you do need to jump through a few hoops, that's why it needs to be factored out. It's perhaps lamentable that a similar overload of drawContents doesn't exist.
I'm trying to give ccsprite blink effect by adjusting brightness.
so I need to adjust contrast of ccsprite.
How to do that?
CCSprite* ccs_sprite = CCSprite::create("button.png");
ccs_sprite->setPosition(ccp(500, 500));
ccs_sprite->setContrast()???
addChild(ccs_sprite);
You can get a blink effect by adjusting the opacity of the sprite with the setOpacity method and alternatively using the CCFadeIn, CCFadeOut and CCFadeTo actions.
Edit:
There is also the CCTintTo and CCTintBy actions that will adjust the RGB colors of the node.
You can visit here for detail reference about classes in cocos2d-x
http://www.cocos2d-x.org/reference/native-cpp/V2.2/d4/de7/classcocos2d_1_1_c_c_sprite.html
I am currently learning how to use HTML5 new elements and I stumbled upon a frustrating issue with all graphic functions such as fillRect() and drawImage().
I was setting the widgth and height with
style="width: 75px;height: 10px;"
instead of
width="200" height="100"
The result being that the graphics would not be the proper scale ever.
My question is, why does it make a difference? There is something I obviously do not understand about it all.
Thank you
I know that at least in JSF (specifically primefaces) the difference is that if you put height in the style- it will not be used to properly calculate and render the component (the more complex ones) sometimes. If you put it as attribute then it will work.
If HTML5 takes the similar approach it would mean that attribute height and width are the actual height and width of the component and the style is just the way to display it. Sometimes however, both approaches are going to end with the same result.
Also in primefaces when you specify height and width as attribute- you can not use percentages. This could be the key- an additional measure of enforcing specific width and heights rathen than percentages.
It was an extremely frustrating issue trying to figure out why canvas
doesn't render its shapes correctly despite doing everything right.
The fix was to set "canvas.height" and "canvas.width" correctly. Just setting "canvas.style.height" and "canvas.style.width" doesn't
rectify internal rendering of the canvas.
Almost every time, your
canvas.height = canvas.style.height
AND
canvas.width = canvas.style.width
I read somewhere that the HTML engine refers "canvas.width" and "canvas.height" while doing the calculations for painting shapes and text inside the canvas.
Whereas, "canvas.style.height" and "canvas.style.width" only determine how the browser displays that canvas alongside other HTML DOM elements. Thanks to bjedrzejewski and Munsta0 for asking this question.
I'm working in Flash Builder 4.5 in pure Actionscript 3.0
I have a movieclip (swc) , I am doing the following :
_visualItem.bgMiddle.height = 200;
bgMiddle is an independant clip only has a single shape in it. On debugging the height remains the same (2.2) but the width changes to 5111. Haven't been able to track it down.
Anything I'm missing here?
Possibly some transforms applied to any of the DisplayObjectContainers higher up in the display tree could be affecting the item you're trying to change?