Gradients give the wrong color on iOS mobile safari - ios

I'm developing a mobile app with Cordova Phonegap that uses gradients that stack on top of eachother. On Android everything works as it is supposed to but on iOS the gradients shows up different. The edges are green whereas when I preview it in my browser it is blue as it's supposed to be. There's also this weird transition at the bottom of the page.
This is my css:
#gradient2Layer1 {
position: fixed;
height: 100px;
bottom: 0;
left: 0;
height: 20%;
width: 100%;
color = "blue";
background: -webkit-linear-gradient(270deg, rgba(15,431,28,0) 35%, #b3c6ff 50%,rgb(128,128,128) 100%);
z-index: 100; }
#gradient2Layer2 {
position: fixed;
height: 100px;
bottom: 0;
left: 0;
height: 20%;
width: 100%;
opacity: 0.5;
color = "blue";
background: -webkit-linear-gradient(270deg, rgba(15,431,28,0) 35%, blue 50%, blue 100%);
animation: fadeIn 5s infinite alternate;
z-index: 100; }
How can I fix this?

I really believe this is a typo and you wanted to use rgba(15,43,128,0) (which is the shade of blue you're looking for) instead of rgba(15,431,28,0), which is not even a valid RGB value (limited to 0..255).

Related

How can I implement a box shadow element in swift?

Please see the box attached. I want to implement that box in swift. How can I do it?
Here's the CSS:
background: #FFFFFF;
border: 1px solid #DAD9D9;
box-shadow: inset 2px 2px 0px rgba(0, 0, 0, 0.25);
border-radius: 30px 30px 0px 0px;
Here's what I tried:
self.answerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.0).cgColor
self.answerView.layer.shadowOpacity = 0.25
self.answerView.layer.cornerRadius = 30
self.answerView.layer.shadowOffset = CGSize(width: 2, height: 2);
self.answerView.layer.shadowRadius = 0
Try this:
self.answerView.borderStyle = .none
self.answerView.layer.cornerRadius = 10
self.answerView.layer.backgroundColor = UIColor.systemGray3.cgColor
self.answerView.backgroundColor = UIColor.systemBackground
self.answerView.layer.shadowColor = UIColor.systemGray3.cgColor
self.answerView.layer.shadowOpacity = 1
self.answerView.layer.shadowRadius = 0
self.answerView.layer.shadowOffset = CGSize(width: 0, height: 2.5);
self.answerView.layer.shadowRadius = 0
self.answerView.borderColor = UIColor.systemGray3
self.answerView.borderWidth = 2
If you only want to round the top corners, you should set the appropriate values to CALayer.maskedCorners.

webkit does not animate opacity

I spent full-day to solve this issue, however, I couldn't fix this yet.
I tried to animate opacity from 0 to 1 by webkit animation for ios. however it doesn't work, and the element I applied the animation does not appear. I don't have the same issue with other devices. thank you for your help in advance.
these are solutions I tried.
set visibility:visible to web-kitKeyframes
change "from - to" to"0% to 100%" of web-kitKeyframes
.hello {
position: absolute;
top: 50%;
left: 100%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 5em;
/* for iOS's opacity issue */
color: white;
opacity:0;
-webkit-opacity: 0;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: #f75998;
animation:fadein 0.5s 0.8s forwards;
-webkit-animation: fadein 0.5s 0.8s forwards; /* Safari, Chrome and Opera > 12.1 */
-moz-animation: fadein 0.5s 0.8s forwards; /* Firefox < 16 */
-ms-animation: fadein 0.5s 0.8s forwards; /* Internet Explorer */
-o-animation: fadein 0.5s 0.8s forwards; /* Opera < 12.1 */
}
#-webkit-keyframes fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
appear the element by following the animation setting.
-webkit-opacity has its fallback a plain opacity. Try modeling that with your keyframe by writing:
#keyframes fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
In your animation you animate the opacity property, and don't the -webkit-opacity property. However you can try to remove all -webkit- prefixes and look in a webkit browser if it works.

Split a circular UIView into 5 equal angle pieces

I have a UIView created programmatically like that:
forecastWeatherWheel.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.1)
forecastWeatherWheel.frame = CGRect(x: -(dailyWeatherContainer.frame.width + 100)/2,
y: self.view.bounds.height/2 - ((dailyWeatherContainer.frame.height + 100)/2),
width: dailyWeatherContainer.frame.width + 100,
height: dailyWeatherContainer.frame.height + 100)
forecastWeatherWheel.layer.cornerRadius = forecastWeatherWheel.bounds.size.width/2
forecastWeatherWheel.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(forecastWeatherWheel)
I need to add (again programmatically) 5 subViews to this UIView.
I'm struggling in finding the coordinates for the anchor point of the subViews.
Thinking into Degrees, my circled superView will have to be split into 72° each equal pieces and the coordinates of the border will have to be the anchor point of my subViews.
Something like this:
Like this (starting at the top and going clockwise):
let radius: Double = 100
let cx: Double = 0
let cy: Double = 0
for deg in stride(from: 90, to: -269, by: -72) {
let a = Double(deg)*M_PI/180
let x = cx + radius * cos(a)
let y = cy + radius * sin(a)
print("Angle \(a): \(x), \(y)")
}
If anyone looking for js scripts.
let radius = 460/2;
let cx = radius;
let cy = radius;
$(".ar__creatCircle .ar__each_circles").each(function(i){
let a = 72*i *Math.PI/180
let x = cx + radius * Math.cos(a);
let y = cy + radius * Math.sin(a);
$(this).css({
left: x+"px",
bottom: y+"px",
})
});
.ar__creatCircle {
width: 460px;
height: 460px;
border-radius: 50%;
border: 1px dashed #000;
/* -webkit-transition: all cubic-bezier(0.35, 0.84, 0.57, 1.04) 300ms;
transition: all cubic-bezier(0.35, 0.84, 0.57, 1.04) 300ms; */
z-index: 9;
}
.ar__each_circles {
width: 30px;
height: 30px;
position: absolute;
border-radius: 50%;
background: #54c970;
position: absolute;
z-index: 2;
min-width: 30px;
min-height: 30px;
transform: translate(-50%, 50%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="ar__creatCircle" style="transform: rotate(0deg);">
<div class="ar_circle_innr" >
<div class="ar__each_circles">
</div>
<div class="ar__each_circles">
</div>
<div class="ar__each_circles" >
</div>
<div class="ar__each_circles" >
</div>
<div class="ar__each_circles" >
</div>
</div>
</div>

Border-radius issue on iPad, iPad 2

Having border-radius issues on iPad(3.2), iPad 2 (4.3.2).
Here's the code:
.articles .post .left img{
width:100%;
border-radius: 0 0 100% 0;
-moz-border-radius: 0 0 100% 0;
-khtml-border-radius: 0 0 100% 0;
-webkit-transition: border-radius 1s;
transition-delay: 0.1s;
transition-duration: 0.5s;
transition-property: all;
transition-timing-function: ease;
}
And this is the result I'm getting:
Any ideas on how to get the desired result I'm after?
On iOS 4, use border-radius css on the container of img and set over-flow:hidden.
the container will 'cut' the img into rounded cornor.
its a tweak.
Try adding
-webkit-border-radius: 0 0 100% 0;
As Safari on IOS5 needs that to render border radius.

Possible to have a fully transparent inset box-shadow?

Is it possible to have the two divs with box-shadow overlap with fully transparent edges? In my example, I want to keep the faded, kind of rounded edge, but it's important that the underlying box is visible through the fade. But as you can see the faded edge is not entirely transparent so it will show a white border rather than let the blue color shine through..
Is it possible to make this work without resorting to png or similar?
Example
.bg {
background-image: -moz-linear-gradient(right top , rgba(255, 255, 255, 0) 0%, #FF0000 100%);
box-shadow: 0 0 90px 90px rgba(255, 255, 255, 0) inset;
-webkit-box-shadow: 0 0 90px 90px rgba(255, 255, 255, 0) inset;
-moz-box-shadow: 0 0 90px 90px rgba(255, 255, 255, 0) inset;
opacity: 0.7;
position: absolute;
}
I don't know whether this is possible with inset box-shadow; however you can make them overlap seamlessly with outset box-shadow for the overlapping element.
All you have to do is give the overlapping element a box-shadow color that is the same as its background-color.
I have edited your sample here: (I didn't copy all the vendor-specific prefixes, just used box-shadow).
http://jsbin.com/orajot/4/edit

Resources