logo
down
shadow

Box shadow animation on SVG element


Box shadow animation on SVG element

Content Index :

Box shadow animation on SVG element
Tag : svg , By : desmiserables
Date : November 26 2020, 01:01 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How to remove a shadow root from an HTML element adorned with a Shadow DOM from a template?


Tag : html , By : Sonal
Date : March 29 2020, 07:55 AM
Hope that helps You can't remove a shadow root once you add it. However, you can replace it with a newer one.
As mentioned here, http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-301/, the newest shadow root "wins" and becomes the rendered root.

CAShapeLayer shadowPath animation. How to prevent shadow fill on animation completion?


Tag : swift , By : RichAA
Date : March 29 2020, 07:55 AM
Hope that helps I was able to solve the issue, with the help of this answer, by creating a CALayer for the shadow and adding the CAShapeLayer as a sublayer:
    let path = createBezierPath() // Get a path
    let color = randomCGColor() // Color of path and shadow
    let lineWidth = CGFloat(arc4random_uniform(50) + 11) // Width of line and shadow radius

    // Shape layer properties
    shapeLayer.path = path.CGPath
    shapeLayer.lineJoin = kCALineJoinRound
    shapeLayer.lineCap = kCALineCapRound
    shapeLayer.strokeColor = color
    shapeLayer.lineWidth = lineWidth
    shapeLayer.fillColor = UIColor.clearColor().CGColor

    // Create shadow layer
    let shadowLayer = CALayer()
    shadowLayer.frame = self.bounds
    shadowLayer.shadowColor = color
    shadowLayer.shadowOffset = CGSizeZero
    shadowLayer.shadowRadius = lineWidth
    shadowLayer.shadowOpacity = 1.0
    shadowLayer.backgroundColor = UIColor.clearColor().CGColor
    shadowLayer.insertSublayer(shapeLayer, atIndex: 0)

    // Add shadow layer
    self.layer.addSublayer(shadowLayer)

    // Stroke path animation
    let pathAnimation: CABasicAnimation = CABasicAnimation(keyPath: "strokeEnd")
    pathAnimation.fromValue = 0.0
    pathAnimation.toValue = 1.0
    pathAnimation.duration = 5.0
    shapeLayer.addAnimation(pathAnimation, forKey: "strokeAnimation")

    // Shadow path animation
    let shadowPathAnimation: CABasicAnimation = CABasicAnimation(keyPath: "shadowPath")
    shadowPathAnimation.fromValue = 0.0
    shadowPathAnimation.toValue = path.CGPath
    shadowLayer.addAnimation(shadowPathAnimation, forKey: "shadowAnimation")

Cannot add box-shadow or text-shadow to the Z's in this animation


Tag : javascript , By : Ruchi
Date : March 29 2020, 07:55 AM
it fixes the issue text-shadow works fine for this. You probably adjusted the offset on accident.
//Pig face position
var elmFace = $("#face").offset();

function snore() {
  //Create Z
  var elm = document.createElement("span");
  //Text
  elm.innerText = "Z";
  //Set attributes
  elm.setAttribute("class", "z");
  //Get positions
  posTop = elmFace.top + 20;
  posLeft = elmFace.left + ($("#face").width()/2) + 35;
  aniTop = posTop - 160;
  aniLeft = (posLeft-40) + Math.round(Math.random()*80);
  //Style/position it
  $(elm).css({
    "top": posTop,
     "left": posLeft
  });
  //Append
  $("body").append(elm);
  //Animate
  $(elm).animate({
    "top": aniTop,
    "left": aniLeft,
    "font-size": "60px",
     "opacity": 0
    },
    5000, //Duration
    function() { //Function
      $(this).remove(); //Remove
  });
}

setInterval(snore, 1000);
snore();
/* -- THE BODY -- */
.body {
}

#face-wrap {
  margin: 160px auto 0;
  width: 160px;
}

#face {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 80px;
  background: rgb(255, 200, 200);
  transform: rotate(15deg);
  -webkit-transform: rotate(15deg);
  -moz-transform: rotate(15deg);
  -o-transform: rotate(15deg);
}

.ear {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 35px;
  background: rgb(255, 200, 200);
}
#ear-l {
  left: -20px;
}
#ear-r {
  left: +110px;
}

.eye {
  top: +75px;
  position: absolute;
  width: 40px;
  height: 4px;
  background: rgb(255, 250, 250);
}
#eye-l {
  left: +14px;
}
#eye-r {
  left: +100px;
}

#nose {
  position: absolute;
  top: +75px;
  left: +47px;
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background: rgb(250, 160, 160);
}
.nose {
  top: +13px;
  position: absolute;
  width: 7px;
  height: 35px;
  background: rgb(255, 125, 125);
}
#nose-l {
  left: +16px;
}
#nose-r {
  left: +36px;
}


/* -- ZZZzzzz -- */
.z {
  position: absolute;
  color: black;
  font-family: arial;
  font-size: 0;
  font-weight: bold;
  text-shadow: 1px 1px 3px pink;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="face-wrap">
  <div id="face" class=" body">
    <div id="ear-r" class="ear body"></div>
    <div id="ear-l" class="ear body"></div>
    <div id="eye-r" class="eye body"></div>
    <div id="eye-l" class="eye body"></div>
    <div id="nose">
      <div id="nose-r" class="nose body"></div>
      <div id="nose-l" class="nose body"></div>
    </div>
  </div>
</div>

How to set a box-shadow to the div element to all sides, left-shadow, right-shadow, top-shadow, bottom-shadow?


Tag : development , By : Doug
Date : March 29 2020, 07:55 AM

Shadow DOM not shown in Custom Element with Shadow Root when inspected on Salesforce (Rabbit hole)


Tag : javascript , By : picamiolo
Date : March 29 2020, 07:55 AM
I wish this helpful for you Salesforce Lightning doesn't use a real (native) Shadow DOM.
That's why you don't see the #shadow-root (open) document fragment in the Elements inspector.
Related Posts Related QUESTIONS :
shadow
Privacy Policy - Terms - Contact Us © scrbit.com