I have a custom view that accepts drags. In the custom view there is an image and the words Drag items here. I would like to make it where when dragging an item over the view the image will fade into another image, then when dragging away it will fade back to the original image. Also, when it will fade into the new image I will make the words Drag items here fade away, then fade back again when dragging away. I think I can do this with another view but I want to keep the original view so that it will continue to accept drags. What is the right approach to do this?
Take a look at Apple demo ImageTransition, it does what you want, at least for image
Related
I have a background image and I need to add bunch of oval buttons or images on in my case the "greenish" buttons on top of the background image, that I can click in each one of them and call a function passing a parameter. Please look on the screen shot and let me know how I can position every one of the buttons on top of the image and access them with a click (onPress). I guess the only way is using flex box but I couldn't figure out the style for it.
Thanks
Just style all the green buttons on relatively to the image's boundaries with position: absolute. Percentage values for positioning should work, if your image scales properly on screen size change.
I am currently using the Image control in XAML, when the user taps on the image I want to display another image like a tap effect*, so for example I want to make the image a bit darker or lighter once the user taps on it, how can I do this using the image control?
I've managed to fix this with adding a new image to the mousebuttonup, mousebuttondown and mouseleave event of the image control
You could place a collapsed image with the same size at the same position as the first one. If the user taps the image, you show the previously collapsed image.
If you want to make your first image darker, set the background of your hidden image to black and opacity to 0.25 or something like this. When it gets visible your first image will be slightly darker.
Instead that you can try to customize the style of your button. In Visual State>>Pressed>>You can change the Color or you can give some animation as well.
tHANKS,
I'm wanting to have a template of a Magic-type card (but with an irregularly shaped art section), where a user can upload their own image and drag it around to place it, but the template will still be in the foreground. I know with the EaselJS library, by default the "hit area" for clicks (to trigger things like click and drag) is only the visible pixels, so you could click "through" the transparent portion of a PNG and drag an element that is under it. So I'm looking for something like that with KineticJS. How would I do that?
Figured it out. createHitRegion is what I was looking for.
I tried sample code in App Dev Center, but the code only can show images side by side and fill all scroll view, I want to realize like attached picture, who can give me some thoughts? Thanks~!
The width of a "page" when you use a paging scroll view is the width of the scroll view itself. So if you want to use that feature, the scroll view must be the width of the pix plus half the width of the borders on either side, so that the next picture will come into place correctly. Now, if you don't want to hide the picture at the right before it's been paged into the scroll view, just don't turn on clipsToBounds.
I want to build a custom control that would work like this:
You have a kind of NSButton with an image.
You click the button and than appears a big square with a grid of photos.
You click one of the photos and it is set up as new image for the button. (square dissapears)
Now, how to draw this big square with photos if I want it not to be limited to window frame?
I mean, if the button was close to window border the square is going to be partially outside window. I would also like to add some shadow to the square and an animation for opening/closing.
One important thing: I want to be able to draw not only a square but any other simple shape (circle)!
This isn't really a drawing question so much as a general custom views question. It's important to make that distinction.
I'll describe this in terms of rectangles to give you the general idea*. You should make sure you understand the view hierarchy and view geometry in Cocoa. Without this important requisite knowledge, you'll remain dead in the water.
It's easy to set an NSButton's image, so I'll leave that to you. Your button's action, however, would tell some controller to show the "image picker" for the given button. Your image picker would be some type of borderless window with an image list inside. The image picker could be an IKImageBrowserView (you'll have to enable Image Kit in Interface Builder for this control to appear), which gives you an iPhoto-like grid of images (with/without titles, different border types, etc.).
An explanation of the operation of this controller and how it creates the window, manages the selection, and sets the button's image is very broad so if you get hung up on any of those steps, you'll need to create a separate question for each problem, otherwise this answer would have to be an instruction manual for writing your app for you.
* Your problem is a little more difficult because of your desire to have differently-shaped "popup windows" ... you'd have to make sure your available photos fit neatly within the shape so none of them are cut off. Armed with the basic knowledge of view geometry, I'll leave this to you as an exercise. A hint: you can use a borderless, transparent window to host a view that draws itself in any shape you please.