easeljs background image rect - cover - createjs

I have a shape in easeljs. When it is initially created it has a backgroundcolor set to white. Then, at some point later down the line, I need to give this rectangle shape a background image - I really can't get it to work.
I would like the background image of the shape to be positioned like this:
background-image: url(images/background.svg);
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
Anyone who can tell me how to approach this. Thanks :)

If you want to use a background image with EaselJS, you can't use CSS.
You can instead use the bitmapFill with EaselJS graphics, which does a pattern fill using an image.
var img = document.createElement("img");
img.src = "path/to/image";
var shape = new createjs.Shape();
shape.graphics.beginBitmapFill(img, "optionalRepeat", optionalMatrix);
shape.graphics.drawRect(0,0,100,100);
Here is a quick fiddle showing it in action: http://jsfiddle.net/lannymcnie/ogy1qmxn/2/
Cheers,

Related

Python module Pisa: how change background color for all page?

How i can change background color of all page?
like this :
body,div { background-color:#f4f4f4; }
Now background changes only for div with information, remaining page have white color. if it is possible, can you write example?
P.s. How i can draw border around ?
Acording to the documentacion https://github.com/chrisglass/xhtml2pdf/blob/master/doc/usage.rst#supported-page-properties-and-values #page only accept few css propierties:
background-image
size
margin, margin-bottom, margin-left, margin-right, margin-top
So maybe the easyest is to make a jpg to draw the background with background color and border. And use that image in background-image propierty:
#page {background-image: url('local_path/to/your/image.jpg')}
I hope this will help you
html,body{height:100%}
body,div { background-color:#f4f4f4; }
and your Second Question > How i can draw border around ?
add
border:1px #ccc solid

Hiding content outside of background and show when scrolling

Working URL:
http://webstage.co/scroll/stack.html
What I am trying to accomplish is to hide the content when it is outside of the background area (1280x800). I like the way the backgrounds are coming in when you scroll to a new section, but I want to hide the content until it gets into that 1280x800 viewport? Any suggestions on how I can accomplish this?
Bonus...It would be great if I could also hide the content under the top navigation once it scrolled up under it as well. A guy can dream. :)
Thanks!
For the first part you can add another div and target with css something like this:
.viewport {
width: 1280px;
height: 100%;
position: fixed;
top: 0;
left: 50%;
margin-left: -640px;
background: black;
clip: rect(800px, 1280px, auto, auto);
}
Basically, set the background to the same color as the page background and use clip to only display the portion of the div that sits below your desired viewport area hiding the content outside the viewport area.
If you add content to the footer later you may need to tweak some z-index settings to make sure it sits on top of the viewport div.

img with border-radius overlays its border

In webkit if I set border radius on an image that has a border, the image won't sit nicely within the border but overlay the border and remains square.
http://jsfiddle.net/ECNJ4/
Any fixes that don't mean using a background image instead or adding markup?
check out: http://jsfiddle.net/ECNJ4/6/
CSS
img {
border-radius: 15px;
box-shadow: 0 0 0 16px red;
}
​
I had to use a wrapper element around the img to make it work. Maybe there's a better solution, but I didn't find it.

vml clipping mask

I am trying to create a clipping mask in VML that would correspond to clip-path in SVG? Is that possible?
Based on numerous, but fairly limited, examples I have tried drawing the shape:
<vml:group style="WIDTH: 1px; HEIGHT: 1px" class=vml-element coordsize = "1,1">
<vml:shape style="WIDTH: 1px; HEIGHT: 1px" id=vectorObject2 class=vml-element _fill-color="red" _fill-opacity="1" _stroke-color="black" _stroke-opacity="1" _stroke-width="1" coordsize = "1,1" filled = "t" fillcolor = "red" stroked = "t" strokecolor = "black" strokeweight = ".75pt" path = "m0,0 l100,0,0,100 xe">
<vml:fill class=vml-element opacity = "1"></vml:fill>
<vml:stroke class=vml-element opacity = "1"></vml:stroke>
</vml:shape>
</vml:group>
and then masking it using vmlframe:
<vml:vmlframe class=vml-element clip = "t" size = "15pt,37.5pt" src = "#vectorObject2"> </vml:vmlframe>
Drawing of shape (triangle) works as expected but I cannot find I way to mask it using vmlframe. Is that the right way to achieve masking?
Please ignore all bunch of weird custom attributes as majority of VML code was generated via 3rd party library.
Thanks in advance!
Use the CSS clip property to emulate clip-path as demonstrated in the Dojo GFX library or something like jsgraphics.

Why are these PNG files black (background) on mouse over and not transparent?

I'm building a Magento shop for a client, I uploaded some test images for the products but they seem to have a black background whenever I mouse over using chrome. Does anyone understand why? I don't see any problems with css so it has to be the images themselves.
URL: (I'm talking about those images below 'New products' and 'featured')
http://bit.ly/zuRH2O
I made those using photoshop and the png-24 save-for-web option (http://bit.ly/zGXTAo). Been doing that for years and this is actually the first time happening.
The problem is in your css. Look at the background image:
a.product-image {
margin-bottom: 10px;
width: 182px;
height: 239px;
border: 1px solid #2F3238;
background: url("/images/thumb_bg.png") 50% top no-repeat;
display: block;
border-image: initial;
If you right click on the images, and view in new tab you will see that they are transparent. Your background is dark, so the image picks that up.