Cocos2D iPhone: have sprite fade to other sprite - cocos2d-iphone

In my game, I want a scene with a gray sprite. After two seconds, I want the sprite to fade into white (or fade into a form of the sprite that is white).
This acts kind of like the CSS3 transition property, where a thing can fade into another color. How is this possible in Cocos2D?

Look at the CCFadeIn/CCFadeOut actions, you can apply that to the sprites to get the effect that you want.

Related

What is the difference between a Viewport and a View?

Why would you need a viewport? Isn't a View engough? What is the difference?
I have one viewport in my program created so long ago that I forgot it was even there... And now that I want multi-staged rendering and I wonder if I need another one. And the Viewport mdocs page doesn't get into how and why (or maybe I'm blind).
A viewport is how much of the window a view takes up.
A view is what should be visible in that viewport.
A good scenario of having many viewports would be in a splitscreen game.
In a splitscreen game, each player has their own section of the screen. The game can not render one players view inside another players viewport.
Many viewports can also be useful in singleplayer games, like to render a minimap.
Many viewports can also be useful outside of games, like in a text editor. You could have one viewport for the text, and the other for a toolbar.
Think of each window on your computer as being a viewport. You could be in an application that has scrolling, but that is the view moving, not the viewport. When you resize the window, or move the window, you are moving the viewport on your screen - not the view.

Centering view on mouse cursor in C++ and OpenGL

I have an OpenGL scene set up like so:
The scene has a single camera. The camera cannot rotate but it can zoom and pan.
The camera is looking directly at a textured quad.
I can get the raycasting result that's generated from the mouse cursor position extending to the quad.
I need the camera to center on the mouse cursor position when I press a keyboard button. How do I do this? FYI the quad most remain in place but the camera can move around.

COCOS2DX, Adding Sprite To Parent

I have created the ball sprite as a parent sprite and i need to add a child sprite in all the boundary of the parent sprite. by defaultly the parent image png it take as square shape, But i want to add like circle. What i can do in COCOS2d-X to add child around circle boundry?
Try drawing a circle, you can use this post as reference. This drawn circle has a perfect round boundary. Attach that to your parent circle image (the one with square boundaries) and set it to invisible. Now you can use attach the child sprites to that invisible drawn circle. It will have the illusion that the child sprites are attached to the circle image.

How to enable zooming in QtCharts?

I want to be able to zoom in my QtCharts using the mouse.
The best way to zoom using the mouse would be by drawing rectangles and adjusting the view to the new smaller rectangle.
How Can I implement this in QtCharts?
Highcharts has a very similar example and it looks quite nice:
This functionality is provided by QChartView:
QChartView v;
v.setRubberBand(QChartView::HorizontalRubberBand);
There is also zooming out functionality bound to your mouse:
If the left mouse button is pressed and the rubber band is enabled, ... the rubber band is displayed on the screen. This enables the user to select the zoom area.
Otherwise use the zooming functions in QChart.

How do I create a rotating cube effect in Qt?

I have a QGraphicsView and a slide show of QGraphicsScenes, at the moment when the user switches to the next slide I just change the Scene that the View is looking at and it changes instantly to reflect that.
What I would like to do it create some transition effects, such as the rotating cube or the slide in/out.
However looking at the QPropertyAnimation class it seems to be about moving an object not transitioning from one to another.
As in I would need a view for each scene and then transition between each view.
What other strategy could I employ?
Instead of changing the scene that the view sees, you could use property animations to slide graphic items in and out of the view from a single scene. That would give you the slide in/out transition without too much effort. The rotating cube effect would be trickier but I think a reasonable facsimile could be produced with property animations.
You could also simulate other effects by subclassing the view widget and adding some custom properties that you could animate and use to direct background or foreground painting.